<%
layout("/layouts/platform.html"){
%>
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-primary navbar-btn" href="${base}/chain/transaction" data-pjax><i class="ti-angle-left"></i> 返回</a>
    </div>
</header>

<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/chain/transaction/addDo" method="post">
                <div class="row mb10">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <label for="copyRightId" class="col-sm-2 control-label">版权号</label>
                            <div class="col-sm-8">
                                <select id="copyRightId" name="copyRightId" data-parsley-required="true" class="form-control">
                                    <option value="">请选择版权号</option>
                                    <%if(!isEmpty(list)){ for(o in list){
                                    %>
                                    <option value="${o.id}">${o.code}</option>
                                    <%
                                    } }%>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="bayer" class="col-sm-2 control-label">买家姓名</label>
                            <div class="col-sm-8">
                            <input type="text" id="bayer" class="form-control" name="bayer" data-parsley-required="true" placeholder="买家姓名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="seller" class="col-sm-2 control-label">卖家姓名</label>
                            <div class="col-sm-8">
                            <input type="text" id="seller" class="form-control" name="seller" data-parsley-required="true" placeholder="卖家姓名">
                            </div>
                        </div>
                        <!--<div class="form-group">-->
                            <!--<label for="blockChainTransactionCode" class="col-sm-2 control-label">区块链交易号</label>-->
                            <!--<div class="col-sm-8">-->
                            <!--<input type="text" id="blockChainTransactionCode" class="form-control" name="blockChainTransactionCode" data-parsley-required="true" placeholder="区块链交易号">-->
                            <!--</div>-->
                        <!--</div>-->
                        <div class="form-group">
                            <label for="amount" class="col-sm-2 control-label">交易额</label>
                            <div class="col-sm-8">
                            <input type="text" id="amount" class="form-control" name="amount" data-parsley-required="true" placeholder="交易额">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="comment" class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-8">
                            <input type="text" id="comment" class="form-control" name="comment" data-parsley-required="true" placeholder="备注">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="transactionTime" class="col-sm-2 control-label">交易时间</label>
                            <div class="col-sm-8">
                            <input type="text" class="datetimepicker"  id="transactionTime" class="form-control" name="transactionTime" readonly>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3"></div>
                <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
                        </div>
                    </div>
                </div>
            </form>
        </section>
    </div>
</div>
<script language="JavaScript">
    $(document).ready(function () {
        $('#addForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    form.resetForm();
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
         initDatepickle();
    });


    function initDatepickle() {
       $('.datetimepicker').datetimepicker({
        minView: "month",//设置只显示到月份
        format: 'yyyy-mm-dd',//显示格式
        todayBtn: true,
        language:"zh-CN",
        autoclose: true,
        startDate: new Date(),  //以前的日期不能点
        bootcssVer:3  //小箭头
        });
    }
</script>
<%}%>


